import request from '../utils/request';



export function getAssetList (data) {
    return request({
        url: '/web/asset/selectAssetAllList',
        method: 'post',
        data
    });
};
export function addAsset (data) {
    return request({
        url: '/web/asset/addAsset',
        method: 'post',
        data
    });
};
export function deleteAsset (data) {
    return request({
        url: '/web/asset/deleteAsset',
        method: 'post',
        data
    });
};

export function lendingAsset (data) {
    return request({
        url: '/web/asset/AssetLending',
        method: 'post',
        data
    });
};

export function assetReturn (data) {
    return request({
        url: '/web/asset/AssetReturn',
        method: 'post',
        data
    });
};



export function getOriginalAsset (data) {
    return request({
        // url: '/web/asset/selectAssetOriginalAllList',
        url: '/web/asset/selectAssetOriginalAllListByCondition',

        method: 'post',
        data
    });
};


export function addOriginalAsset (data) {
    return request({
        url: '/web/asset/addAssetOriginal',
        method: 'post',
        data
    });
};

export function deleteOriginalAsset (data) {
    return request({
        url: '/web/asset/deleteAssetOriginal',
        method: 'post',
        data
    });
};


export function updateOriginalAsset (data) {
    return request({
        url: '/web/asset/updateAssetOriginal',
        method: 'post',
        data
    });
};
export function updateAsset(data) {
    return request({
        url: '/web/asset/changeAsset',
        method: 'post',
        data
    });
};



export function addAssetType (data) {
    return request({
        url: '/web/config/assetClassConfig/add',
        method: 'post',
        data
    });
};


export function deleteAssetType (data) {
    return request({
        url: '/web/config/assetClassConfig/delete',
        method: 'post',
        data
    });
};


export function getAssetType (data) {
    return request({
        url: '/web/config/assetClassConfig/list',
        method: 'post',
        data
    });
};

export function updateAssetType (data) {
    return request({
        url: '/web/config/assetClassConfig/update',
        method: 'post',
        data
    });
};

export function reqFn (url,data) {
    return request({
        url: url,
        method: 'post',
        data
    });
};


export function getAssetsTypeConfigData (data) {
    return request({
        url: '/web/config/assetClassConfig/list',
        method: 'post',
        data:{
            currentIndex:1,
            size:99999999
        }
    });
};
export function getMaterialTypeConfigData (data) {
    return request({
        url: '/web/config/materialConfig/list',
        method: 'post',
        data:{
            currentIndex:1,
            size:99999999
        }
    });
};
export function getStorageTypeConfigData (data) {
    return request({
        url: '/web/config/storageConfig/list',
        method: 'post',
        data:{
            currentIndex:1,
            size:99999999
        }
    });
};
export function getUserTypeConfigData (params) {
    return request({
        url: '/web/user',
        method: '',
        params:{
            current:1,
            size:99999
        },
        requestBaseUrl:'outside'
    });
};


// export function getAllUserData (params) {
//     return request({
//         url: '/web/user',
//         method: '',
//         params:{
//             current:1,
//             size:20,
//             ...params
//         },
//         requestBaseUrl:'outside'
//     });
// };

export function getAllUserData (params) {
    return request({
        apiType:'CAR',
        baseURL: 'carmanage',
        url: '/web/user/getSsoUserByPage',
        method: '',
        params:{
            current:1,
            size:20,
            ...params
        },
    });
};




//批量入库
export function bulkStorageApi (data) {
    return request({
        url: '/web/asset/importAssetExcel',
        method: 'post',
        data,
        headers:{
            'Content-Type': 'multipart/form-data;charset=UTF-8'
        },
        requestBaseUrl:'uploadFile'
    });
};

//下载模板
export function getAssetTemplateApi (params) {
    return request({
        url: '/web/asset/getAssetTemplate',
        method: 'get',
        params:{
            ...params
        },
    });
};




//资产借还记录
export function lendingAndReturnRecordApi (data) {
    return request({
        url: '/web/asset/selectLendingAndReturnList',
        method: 'post',
        data
    });
};





const getType={
    "资产分类":'/web/config/assetClassConfig/list',
    "资产状态":'/web/config/materialConfig/list',
    "存放点":'/web/config/storageConfig/list',
}
const addType={
    "资产分类":'/web/config/assetClassConfig/add',
    "资产状态":'/web/config/materialConfig/add',
    "存放点":'/web/config/storageConfig/add',
}

const deleteType={
    "资产分类":'/web/config/assetClassConfig/delete',
    "资产状态":'/web/config/materialConfig/delete',
    "存放点":'/web/config/storageConfig/delete',
}

const updateType={
    "资产分类":'/web/config/assetClassConfig/update',
    "资产状态":'/web/config/materialConfig/update',
    "存放点":'/web/config/storageConfig/update',
}

export{
    getType,addType,deleteType,updateType
}

